#include<iostream.h>
#include<conio.h>

class complex
{
float x,y;

public:

void add(complex);
void getdata()
{
cout<<"\n"<<"enter real and imaginary part";
cin>>x>>y;
}
void putdata()
{
cout<<"complex number"<<x<<"+"<<y<<"i"<<endl;

}

};

void complex::add(complex a)
{
cout<<"sum of the numbers ="<<(x+a.x)<<"+"<<(y+a.y)<<"i"<<endl;

}

void  main()
{
clrscr();
complex c1,c2;
c1.getdata();
c2.getdata();
c1.putdata();
c2.putdata();
c1.add(c2);
getch();
}

/* output
enter real and imaginary part 1 3
enter real and imaginary part 3 4
complex number: 1+3i
complex number: 3+4i
sum of the numbers= 4+7i
*/